<?php

// no direct access

defined('_JEXEC') or die('Restricted access');



// Include library dependencies

jimport('joomla.filter.input');



class RegionsTableRegion extends JTable

{



	function __construct(& $db) {

		parent::__construct('#__regions', 'id', $db);

	}

	

	public function bind($array, $ignore = '')

	{

		if (isset($array['params']) && is_array($array['params'])) {

			$registry = new JRegistry();

			$registry->loadArray($array['params']);

			$array['params'] = (string)$registry;

		}



		if (isset($array['metadata']) && is_array($array['metadata'])) {

			$registry = new JRegistry();

			$registry->loadArray($array['metadata']);

			$array['metadata'] = (string)$registry;

		}

		return parent::bind($array, $ignore);

	}

	

	function check()

	{

		// Set ordering
		if ($this->state < 0) {

			// Set ordering to 0 if state is archived or trashed

			$this->ordering = 0;

		} elseif (empty($this->ordering)) {

			// Set ordering to last if ordering was 0

			$this->ordering = self::getNextOrder();

		}

		if(!$this->created)

			$this->created=date('Y-m-d h:i:s');

		return true;

	}
		

		

}

?>